Skip to content

feat(progress-bar): add recipe and tokens#31087

Merged
thetaPC merged 25 commits into
ionic-modularfrom
FW-6857
Apr 28, 2026
Merged

feat(progress-bar): add recipe and tokens#31087
thetaPC merged 25 commits into
ionic-modularfrom
FW-6857

Conversation

@thetaPC
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC commented Apr 17, 2026

Issue number: internal


What is the current behavior?

Component styles for ion-progress-bar are fragmented across multiple files (native and ionic). The md and ios themes rely on the native styles. Developers were restricted to those themes and how those themes structured the logic and styles.

What is the new behavior?

  • Unified Style Architecture: Combined theme-specific styling into a single progress-bar.scss file that consumes CSS variables, ensuring a single source of truth for component logic.
  • Element-First Token Structure: Refactored the IonProgressBar type and tokens to use an element-first hierarchy ({type}.{element}.{state}, e.g., determinate.progress.default.background). This provides predictability and consistency with the rest of the system.
  • Defined TypeScript Interface: Added progress-bar.interfaces.ts with reusable types for the recipe and config.
  • Defined Theme Defaults: Added per-theme token defaults in ios, md, and ionic theme files.
  • Shape Support: Introduced round and rectangular shape variants with per-theme defaults (round for ios and ionic, rectangular for md).
  • Solid State Styling: Introduced dedicated styles for when the progress bar is fully buffered (buffer = 1), including separate rules for the buffer bar and buffer circles.
  • Type-Scoped CSS: Split generic buffer bar styles into type-specific selectors (progress-bar-type-determinate / progress-bar-type-indeterminate) to prevent cross-type style bleed.
  • Updated CSS Variables: Replaced --background and --progress-background with a structured set of semantic variables (e.g., --ion-progress-bar-determinate-progress-default-background).
  • Updated Tests: Added shape snapshot tests.

Does this introduce a breaking change?

  • Yes
  • No

This PR introduces breaking changes to how IonProgressBar is styled.

Migration Path:

  1. Token Updates: Update any custom theme configurations to match the new nested structure.

  2. CSS Variable Replacements: --background and --progress-background have been removed. Use the new token structure instead:

    • --backgroundIonProgressBar.determinate.buffer.bar.default.background (or the indeterminate equivalent)
    • --progress-backgroundIonProgressBar.determinate.progress.default.background (or the indeterminate equivalent)

If per-component customization is needed, the CSS variables can be used directly (e.g., --ion-progress-bar-determinate-progress-default-background).

  1. Host class names: The type classes on the host element have been renamed to include the prop name:

    • .progress-bar-determinate.progress-bar-type-determinate
    • .progress-bar-indeterminate.progress-bar-type-indeterminate
  2. Theme classes: Remove any instances that target the theme classes: ion-progress-bar.md, ion-progress-bar.ios.

Other information

Previews:
Previews:

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Apr 28, 2026 5:54pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Apr 17, 2026
Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just a couple things I noticed but I could be off base

Comment thread core/src/themes/ionic/default.tokens.ts Outdated
},

IonProgressBar: {
height: 'var(--token-scale-100, var(--ion-scaling-100))',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var(--token-scale-100, var(--ion-scaling-100)) wraps a --token-* variable I couldn't find defined anywhere in the repo. Same on lines 532 and 538 with --token-round-xs and --token-rectangular-xs. Is this intentional scaffolding for the ionic modular work? If not, the other component entries in this file (IonChip, IonSpinner, IonItemDivider) reference --ion-* directly, so maybe this should too? Not sure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I meant to add a comment here.

You're right that --token-* variables don't exist in this repo. They're defined in the OS project. The intent was to make it easier for the components team to adopt the Ionic token file in the future by referencing --token-* first with --ion-* as a fallback. The components team can override values at the token level without having to make as many changes here. If we approve this change, I plan to go back to the others and add the --token-* variables through a different PR. I figured if it gets denied, then no need to do that extra work. 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we plan to have them override all of these? Like they will redefine this, changing both variables:

height: 'var(--token-space-100, var(--token-scale-100, 4px)',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping that they don't plan on overriding them especially by having it first check for the --token-*. With the fact that their token system changing frequently, it might be best for us to use --token-* instead of the internal token system. So if the value of --token-scale-100 was 4px but then changes to 6px, they won't have to make an update on this repo because the token is still accurate, just the value changed. This is my reason of why I want to add their CSS variables. Does that answer your question?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the goal was to not have the themes behave differently from each other. By adding another layer of tokens here we are doing that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood! Then I'll revert to what we've been doing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);
}

:host(.progress-bar-solid) .buffer-circles {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When progress-bar-solid is set, the render function applies ion-hide (display: none !important) to the parent .buffer-circles-container, so this .buffer-circles rule inside it can't paint. Is the plan to drop the ion-hide toggle later and let CSS handle the hide, or is this rule dead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 6a19f57

It sounds like we will keep ion-hide but just a different class name.

class={{ 'buffer-circles-container': true, 'ion-hide': finalBuffer === 1 }}
class={{
'buffer-circles-container': true,
'buffer-circles-container-hidden': finalBuffer === 1,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this class now so it would be easier to replace when we remove ion-hide.

Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, Maria! Awesome work! Just two minor nits, but non-blocking

Comment thread core/src/components/progress-bar/progress-bar.tsx Outdated
Comment thread core/src/components/progress-bar/progress-bar.tsx
Co-authored-by: Shane <shane@shanessite.net>
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this! 💪

Comment thread core/src/components.d.ts Outdated
Comment thread core/src/themes/md/default.tokens.ts
Comment thread core/src/themes/ionic/default.tokens.ts Outdated
},

IonProgressBar: {
height: 'var(--token-scale-100, var(--ion-scaling-100))',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we plan to have them override all of these? Like they will redefine this, changing both variables:

height: 'var(--token-space-100, var(--token-scale-100, 4px)',

Comment thread core/src/components/progress-bar/progress-bar.tsx Outdated
Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
@thetaPC thetaPC merged commit a392a46 into ionic-modular Apr 28, 2026
49 checks passed
@thetaPC thetaPC deleted the FW-6857 branch April 28, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants